﻿<%@ Page Language="C#" MasterPageFile="~/MuseumOwner.master" AutoEventWireup="true"
    CodeFile="ManageCity.aspx.cs" Inherits="ManageCity" Title="Manage City" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tr>
            <td colspan="3" align="center">
                <b style="font-size: x-large;">Manage Cities</b>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblCountry" Text="Country" runat="server"></asp:Label>
            </td>
            <td>
                :
            </td>
            <td>
                <asp:DropDownList ID="ddlCountry" runat="server" Width="200px" DataTextField="CountryName"
                    DataValueField="CountryID" AutoPostBack="true" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <div id="divGridView">
                    <asp:GridView ID="GridViewCities" runat="server" EnableViewState="False" Width="100%"
                        BorderWidth="1" CellPadding="4" ForeColor="#333333" GridLines="Both" AutoGenerateColumns="false"
                        DataKeyNames="CityId" AutoGenerateDeleteButton="false" EmptyDataText="No records found"
                        AllowPaging="true" AllowSorting="true" PageSize="10" AlternatingRowStyle-BackColor="White"
                        OnPageIndexChanging="gridView_PageIndexChanging" OnSorting="gridView_Sorting"
                        RowStyle-CssClass="record" OnRowDeleting="DeleteRecord">
                        <RowStyle CssClass="record"></RowStyle>
                        <HeaderStyle BackColor="#A59072" HorizontalAlign="Left" Font-Bold="True" ForeColor="White" />
                        <Columns>
                            <asp:BoundField DataField="CityId" HeaderText="ID" />
                            <asp:BoundField HeaderText="City Name" DataField="CityName" />
                            <asp:BoundField HeaderText="Country Name" DataField="CountryName" />
                            <asp:TemplateField HeaderText="Edit">
                                <ItemTemplate>
                                    <a href="CityDetails.aspx?PageMode=Edit&CityID=<%# Eval("CityId") %>"
                                        title="Edit">Edit</a>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Delete">
                                <ItemTemplate>
                                    <span onclick="return confirm('Are you sure to Delete the record?')">
                                        <asp:LinkButton ID="lnkB" runat="Server" Text="Delete" CommandName="Delete"></asp:LinkButton>
                                    </span>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <p>
                        <asp:Label ID="lblMessage" runat="server" EnableViewState="false" ForeColor="Red" />
                    </p>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:LinkButton ID="lnkbtnNewCity" runat="server" PostBackUrl="~/CityDetails.aspx"
                    Text="New City"></asp:LinkButton>
            </td>
        </tr>
    </table>
</asp:Content>
